﻿using UnityEngine;
using System.Collections;
using Fungus;
using CommonIoC;

public class TriggerGetTank : MonoBehaviour
{

    [Header("Fungus的Flowchart对象")]
    public FlowchartView  flowchartview;

    // Use this for initialization
    void Start()
    {
        Find_FlowChat();

        bool result = GameDataManager.Instance.GetTalkValueByKey("发现1号战车的对话");
        if( result )
        {
            DestoryThisObject();
        }

    }

    void Find_FlowChat()
    {
        try
        {
            flowchartview = GameObject.Find("MainFlowchart").GetComponent<FlowchartView>();
        }
        catch
        {
            Debug.Log("未找到Flowchart对象");
        }
    }



    // Update is called once per frame
    void Update()
    {

    }

    void OnTriggerEnter2D(Collider2D other)
    {
        // characterInQuicksand = true;
        // Debug.Log("TARGGERED" + NextSceneName);
        //AsyncLoadSceneCallBack.StartAsyncLoadSceneCoroutine(NextSceneName);

        if (other.tag.Equals("Player"))
        {

            Debug.Log("Trigger is...");
            flowchartview.Set_TalkToGet_1_Tank();
            //SceneLoadManager.Instance.Set_Prev_Door(pre_door);

            //SceneLoadManager.Instance.LoadNext(next_scene);


        }
    }

    public void DestoryThisObject()
    {
        Destroy(this.gameObject, 0.5f);
    }

}
